/*******************************************************************************
 * Copyright (c) 2011 LegSem.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl-3.0.txt
 * 
 * Contributors:
 *     LegSem - initial API and implementation
 ******************************************************************************/
package com.legstar.eci.xmi.model;


import java.util.List;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;

/**
 * This class should be implemented as 2 classes: A enclosing SOAP operation
 * binding and a child ECI operation binding. But because both are bound to the
 * same XML tag name "operation", XStream is unable to parse the XML.
 * <p/>
 * By binding both operation elements to the same class, it works, but you get
 * SOAP data only at the upper level and ECI data in a child operation.
 * 
 */
@XStreamAlias("operation")
public class BindingEciOperation {
	
	@XStreamAsAttribute
	private String name;
	
	@XStreamAsAttribute
	private int commareaLength;
	
	@XStreamAsAttribute
	private String functionName;
	
	@XStreamAsAttribute
	private int interactionVerb;

	@XStreamImplicit()
	private List < BindingEciOperation > operations;

	@XStreamImplicit()
	private List < BindingInput > inputs;

	@XStreamImplicit()
	private List < BindingOutput > outputs;

	/** {@inheritDoc}*/
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("[");
		sb.append("name" + ":" + name + "");
		sb.append(",");
		sb.append("commareaLength" + ":" + commareaLength + "");
		sb.append(",");
		sb.append("functionName" + ":" + functionName + "");
		sb.append(",");
		sb.append("interactionVerb" + ":" + interactionVerb + "");
		sb.append(",");
		sb.append("operations" + ":" + operations + "");
		sb.append(",");
		sb.append("inputs" + ":" + inputs + "");
		sb.append(",");
		sb.append("outputs" + ":" + outputs + "");
		sb.append("]");
		return sb.toString();
	}

	/**
	 * @return the commareaLength
	 */
	public int getCommareaLength() {
		return commareaLength;
	}

	/**
	 * @return the functionName
	 */
	public String getFunctionName() {
		return functionName;
	}

	/**
	 * @return the interactionVerb
	 */
	public int getInteractionVerb() {
		return interactionVerb;
	}

	/**
	 * @return the operations
	 */
	public List<BindingEciOperation> getOperations() {
		return operations;
	}

	/**
	 * @return the inputs
	 */
	public List<BindingInput> getInputs() {
		return inputs;
	}

	/**
	 * @return the outputs
	 */
	public List<BindingOutput> getOutputs() {
		return outputs;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

}
